package com.guaju.yueshangclothing.widget;

import android.content.Context;
import android.content.res.TypedArray;
import android.databinding.DataBindingUtil;
import android.util.AttributeSet;
import android.view.LayoutInflater;

import com.guaju.yueshangclothing.R;
import com.guaju.yueshangclothing.databinding.TextBarDividerBinding;
import com.zhy.autolayout.AutoFrameLayout;

/**
 * Created by guaju on 2018/9/29.
 */

public class TextBarDivider extends AutoFrameLayout {
    LayoutInflater inflater;
    private TextBarDividerBinding binding;

    public TextBarDivider(Context context) {
        super(context);
        inflater=LayoutInflater.from(context);
        init();
    }

    public TextBarDivider(Context context, AttributeSet attrs) {
        super(context, attrs);
        inflater=LayoutInflater.from(context);
        init();
        TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.TextBarDivider);
        String barTitle = typedArray.getString(R.styleable.TextBarDivider_barTitle);
        binding.title.setText(barTitle);
    }

    private void init() {
        binding = (TextBarDividerBinding)DataBindingUtil.inflate(inflater, R.layout.text_bar_divider, this, true);
    }
}
